<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>

<body>



    <script>


        printData(deviceId, data) {
            var html = '';
            html += '<print>';

            html += '<tr><td font="H" align="center">**#' + data.companyOrderNumber + '&nbsp;吃喝玩了**</td></tr>';

            html += '<tr><td  font="H" align="center">' + data.companyName + '</td></tr>';

            html += '<tr><td align="center">&nbsp;</td></tr>';

            if (typeof (data.yuyuedan) != undefined && data.yuyuedan != '') {
                html += '<tr><td>预&nbsp;约&nbsp;单:' + data.yuyuedan + '</td></tr>';
            }

            if (typeof (data.created) != undefined && data.created != '') {
                html += '<tr><td>下单时间:' + data.created + '</td></tr>';
            }

            if (typeof (data.orderId) != undefined && data.orderId != '') {
                html += '<tr><td>订&nbsp;单&nbsp;号:' + data.orderId + '</td></tr>';
            }

            html += '<tr><td>PC&nbsp;&nbsp;&nbsp;&nbsp;单:' + this.getNowFormatDate() + '</td></tr>';

            html += '<line></line>';

            html += '<tr><td  align="center">下单商品</td></tr>';

            for (var i = 0; i < data.list.length; i++) {

                var item = data.list[i];

                html += '<tr>';

                html += '<td align="left" font="H">' + item.name + '</td>';

                html += '<td align="left" font="H">x' + item.number + '&nbsp;&nbsp;&nbsp;&nbsp;' + item.allMoney + '</td>';

                html += '</tr>';

            }

            if (data.rebate.length > 0) {

                html += '<span align="center">退款商品</span>';

                for (var i = 0; i < data.rebate.length; i++) {

                    var item = data.rebate[i];

                    html += '<tr>';

                    html += '<td align="left" font="H">' + item.goodName + '</td>';

                    html += '<td align="left" font="H">x' + item.number + '&nbsp;&nbsp;&nbsp;&nbsp;' + item.allMoney + '</td>';

                    html += '</tr>';

                }

            }

            html += '<line></line>';

            html += '<tr>';

            html += '<td align="left">包装费:</td>';

            html += '<td align="left">x' + data.boxNumber + '&nbsp;&nbsp;&nbsp;&nbsp;' + data.boxPrice + '</td>';

            html += '</tr>';

            html += '<tr>';

            html += '<td align="left">配送费:</td>';

            html += '<td align="left">' + data.deliveryMoney + '</td>';

            html += '</tr>';

            html += '<tr>';

            html += '<td align="left">已支付:</td>';

            html += '<td align="left">' + data.payMoney + '</td>';

            html += '</tr>';

            html += '<line></line>';

            if (typeof (data.address) != undefined && data.address != '') {
                html += '<tr><td font="H" align="center">' + data.address + '</td></tr>';
            }

            if (typeof (data.userName) != undefined && data.userName != '') {
                html += '<tr><td font="H" align="center">' + data.userName + '</td></tr>';
            }

            if (typeof (data.phone) != undefined && data.phone != '') {
                html += '<tr><td font="H" align="center">' + data.phone + '</td></tr>';
            }

            if (typeof (data.remark) != undefined && data.remark != '') {
                html += '<tr><td font="H" align="center">注:' + data.remark + '</td></tr>';
            }

            html += '</print>';

            console.log(html);
            var res = printer.default.print(deviceId, html, 0);
            console.log(res);
        }


    </script>
</body>

</html>